{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">用户管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('banner/add')}"
                   data-auth-edit="{:$auth->check('banner/edit')}"
                   data-auth-delete="{:$auth->check('banner/del')}"></table>
        </div>
    </div>

</div>

<script type="text/html" id="barTool">
    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs {:$auth->check('banner/edit')?'':'layui-hide'}" title="编辑"><i class='iconfont icon-brush_fill'></i></a>
    <a href='{:url("del")}?id={{ d.id }}' class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del {:$auth->check('banner/del')?'':'layui-hide'}"><i class='iconfont icon-trash_fill'></i></a></script>

{/block}
{block name="script"}
<script type="text/javascript">
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        modify_url:'{:url("multi")}',
        add_url: '{:url("add")}',
        edit_url: '{:url("edit")}',
        delete_url: '{:url("del")}',

    };

    table.render({
        init: init,
        toolbar: ['refresh'],
        url: '{:url("index")}',
        cols: yznTable.formatCols([
            [
                { field: 'uid', width: 80, title: 'UID'},
                { field: 'user.nickname', align: 'center',width: 120, title: '微信昵称'},
                { field: 'username',align: 'center',  title: '真实姓名', searchOp: 'like' },
                { field: 'card_code',align: 'center',  title: '银行卡号', searchOp: 'like' },
                { field: 'phone',align: 'center',  title: '预留手机号', searchOp: 'like' },
                { field: 'id_number',align: 'center',  title: '身份证号', searchOp: 'like' },

                { width: 100, title: '身份证正面', align: 'center', templet: "<div><a target='_blank' href='{{d.card1}}'><img style='width: 40%;height: 100%' src='{{d.card1}}' alt=''></a></div>"},
                { width: 100, title: '身份证反面', align: 'center', templet: "<div><a target='_blank' href='{{d.card2}}'></a><img style='width: 40%;height: 100%' src='{{d.card2}}' alt=''></div>"},
                { field: 'create_time', align: 'center', title: '创建时间', search: 'range' },
                { fixed: 'right', align: 'center', width: 140, title: '操作', toolbar: '#barTool' }
            ]
        ],init),
        page: {}
    });
    yznTable.listenSwitch({filter: 'status', url: init.modify_url});
    yznTable.listenSwitch({filter: 'type', url: init.modify_url});

    yznTable.bindevent();
});
</script>
{/block}